package leecode

func addDigits(num int) int {
	//直到num为1位数循环结束
	for num >= 10 {
		num = one(num)
	}
	return num
}

func one(num int) int {
	var sum int
	//求num的每一位数的和
	for num > 0 {
		temp := num % 10
		num = num / 10
		sum += temp
	}
	return sum
}
